function [R,C,sens]=celdas_skhpgmay1(wp,qp,g,wz,seteados)
%Seteo R1 y R3
%NO LLAMAR SI PARA 1<G<2, Q>1/(sqrt(4*(1-R(3)/R(4)))) 
    R=ones(4,1);
    C=ones(2,1);
    
    R(1)=seteados(1);
    R(3)=seteados(2);
    R(2)=R(1);
    R(4)=R(3)/(g-1);
    a=1;
    b=-1/(R(1)*wp*qp*(1-(R(3)/R(4))));
    c=1/((R(1))^2*(wp)^2*(1-(R(3)/R(4))));
    C(2)=(-b+sqrt(b^2-4*a*c))/(2*a);
    C(1)=1/((wp)^2*(R(1))^2*C(2));
    sens=ones(6,4);
    sens(:,1)=SenSallenHPGmay1W0(R(1),R(2),R(3),R(4),C(1),C(2));
    sens(:,2)=SenSallenHPGmay1Q(R(1),R(2),R(3),R(4),C(1),C(2));
    sens(:,3)=SenSallenHPGmay1G(R(1),R(2),R(3),R(4),C(1),C(2));
    sens(:,4)=[0,0,0,0,0,0];    
end

function [senG]=SenSallenHPGmay1G(r1,r2,r3,r4,c1,c2)
  senG(1)=0;                                            %r1
  senG(2)=0;                                            %r2
  senG(3)=r3/(r4*(r3/r4 + 1));                                 %r3
  senG(4)=-r3/(r4*(r3/r4 + 1));    %r4
  senG(5)=0;                                            %c1
  senG(6)=0;                                            %c2
end

function [senQ]=SenSallenHPGmay1Q(r1,r2,r3,r4,c1,c2)

senQ(1) =-(r1*((r4*(c1*r4 + c2*r4))/((c1*r1*r4 + c2*r1*r4 - c2*r2*r3)^2*(1/(c1*c2*r1*r2))^(1/2)) - r4/(2*c1*c2*r1^2*r2*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(3/2)))*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(1/2))/r4;
senQ(2) =(r2*((c2*r4*r3)/((c1*r1*r4 + c2*r1*r4 - c2*r2*r3)^2*(1/(c1*c2*r1*r2))^(1/2)) + r4/(2*c1*c2*r1*r2^2*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(3/2)))*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(1/2))/r4;
senQ(3) =(c2*r2*r3)/(c1*r1*r4 + c2*r1*r4 - c2*r2*r3);
senQ(4) =(1/((c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(1/2)) - (r4*(c1*r1 + c2*r1))/((c1*r1*r4 + c2*r1*r4 - c2*r2*r3)^2*(1/(c1*c2*r1*r2))^(1/2)))*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(1/2);
senQ(5) =-(c1*((r1*r4^2)/((c1*r1*r4 + c2*r1*r4 - c2*r2*r3)^2*(1/(c1*c2*r1*r2))^(1/2)) - r4/(2*c1^2*c2*r1*r2*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(3/2)))*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(1/2))/r4;
senQ(6) =-(c2*((r4*(r1*r4 - r2*r3))/((c1*r1*r4 + c2*r1*r4 - c2*r2*r3)^2*(1/(c1*c2*r1*r2))^(1/2)) - r4/(2*c1*c2^2*r1*r2*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(3/2)))*(c1*r1*r4 + c2*r1*r4 - c2*r2*r3)*(1/(c1*c2*r1*r2))^(1/2))/r4;

end

function [senw0]=SenSallenHPGmay1W0(r1,r2,r3,r4,c1,c2)

senw0(1) = -1/(2*c1*c2*r1*r2*(1/(c1*c2*r1*r2)));
senw0(2) = -1/(2*c1*c2*r1*r2*(1/(c1*c2*r1*r2)));
senw0(3) = 0;
senw0(4) = 0;
senw0(5) = -1/(2*c1*c2*r1*r2*(1/(c1*c2*r1*r2)));
senw0(6) = -1/(2*c1*c2*r1*r2*(1/(c1*c2*r1*r2)));

end